We need to pass the delta between the old and new hotspot
when attaching the new cursor surface, to keep the hotspot
at the same position. We can't deal with this in the compositor,
since the set_cursor call already overwrites the old hotspot,
so the information is lost by the time the attach happens.
Unfortunately, we can't query the initial hotspot from
the compositor, so the first cursor change will make the
hotspot jump.
https://bugzilla.gnome.org/show_bug.cgi?id=695512
GdkWaylandSelectionOffer *selection_offer_out;
struct wl_surface *pointer_surface;
+ int hotspot_x, hotspot_y;
};
struct _GdkWaylandDevice
_gdk_wayland_display_get_serial (wayland_display),
wd->pointer_surface,
x, y);
- wl_surface_attach (wd->pointer_surface, buffer, 0, 0);
+ wl_surface_attach (wd->pointer_surface, buffer, wd->hotspot_x - x, wd->hotspot_y - y);
wl_surface_damage (wd->pointer_surface, 0, 0, w, h);
wl_surface_commit(wd->pointer_surface);
+ wd->hotspot_x = x;
+ wd->hotspot_y = y;
+
g_object_unref (cursor);
}